package com.hengda.museumonline.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.hengda.museumonline.R;
import com.hengda.museumonline.entity.CityChengeBean;

/**
 * @author：JFWU on 2016/9/26 18:36
 * @E-mail：jeffy12138@126.com
 */
public abstract class HotCityAdapter extends RecyclerView.Adapter<HotCityAdapter.ListHolder> {
    private Context context;
    private CityChengeBean cityChengeBean ;
    public HotCityAdapter(Context context, CityChengeBean cityChengeBean) {
        this.context = context;
        this.cityChengeBean = cityChengeBean;
    }

    @Override
    public HotCityAdapter.ListHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.hotcity_item, parent, false);
        return new ListHolder(view);
    }

    @Override
    public void onBindViewHolder(HotCityAdapter.ListHolder holder, int position) {
        convert(context, holder, position);
    }
    public abstract void convert(Context mContext, HotCityAdapter.ListHolder holder, int position);
    @Override
    public int getItemCount() {
        return cityChengeBean.getData().getHot().size();
    }

    public class ListHolder extends RecyclerView.ViewHolder {
        LinearLayout ll_hotcity;
        TextView hotcity;

        public LinearLayout getLl_hotcity() {
            return ll_hotcity;
        }

        public TextView getHotcity() {
            return hotcity;
        }

        public ListHolder(View itemView) {
            super(itemView);
            ll_hotcity = (LinearLayout) itemView.findViewById(R.id.ll_hotcity);
            hotcity = (TextView) itemView.findViewById(R.id.hotcity);
        }


    }
}
